import createBanner from "./scripts/Banner.js";
import createNavBar from "./scripts/NavBar.js";
import { createPosts } from "./scripts/Post.js";
import { createElementWithClass } from "./scripts/Api.js";
import createFootBar from "./scripts/FootBar.js";

const createMain = () => {
    // 添加Wrapper
    const abstractWrapper = document.createElement('div');
    abstractWrapper.className = "app-container"
    abstractWrapper.id = "app";

    const banner = createBanner();
    abstractWrapper.appendChild(banner);
    const postsSection = createPosts();
    abstractWrapper.appendChild(postsSection);

    return abstractWrapper;
}


// 构建页面
const buildPage = () => {
    const rootNode = document.getElementById('body');
    const navBar = createNavBar();
    rootNode.appendChild(navBar);
    const app = createMain();
    rootNode.appendChild(app);
    const footBar = createFootBar();
    rootNode.appendChild(footBar)
}
window.onload = buildPage;